import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_shop/provide/details_provide.dart';
import 'package:provide/provide.dart';

class DetailsTabBar extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      color: Colors.white,
      width: ScreenUtil().setWidth(750),
      margin: EdgeInsets.only(top: 10.0),
//      padding: EdgeInsets.all(10.0),
      child: Provide<DetailsInfoProvide>(
        builder: (context,child,details){
          return  Row(
            children: <Widget>[
              tabLeftBarWidget(context,details.isLeft,'详情'),
              tabRightBarWidget(context,details.isRight,'评论'),
            ],
          );
        },
      ),
    );
  }


  Widget tabLeftBarWidget(BuildContext context,bool isbool,String title){

    return InkWell(
      onTap: (){
        Provide.value<DetailsInfoProvide>(context).changeLeftAndRight('left');
      },
      child: Container(
        padding: EdgeInsets.all(10.0),
        width: ScreenUtil().setWidth(375),
        alignment: Alignment.center,
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(bottom:BorderSide(
            color: isbool?Colors.pink:Colors.black12,
            width: 0.5,
          ))
        ),
        child: Text(
          title,
          style: TextStyle(
              fontSize: ScreenUtil().setSp(25.0),
            color: isbool?Colors.pink:Colors.black
          ),
        ),
      ),
    );
  }



  Widget tabRightBarWidget(BuildContext context,bool isbool,String title){

    return InkWell(
      onTap: (){
        Provide.value<DetailsInfoProvide>(context).changeLeftAndRight('right');
      },
      child: Container(
        padding: EdgeInsets.all(10.0),
        width: ScreenUtil().setWidth(375),
        alignment: Alignment.center,
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border(bottom:BorderSide(
              color: isbool?Colors.pink:Colors.black12,
              width: 0.5,
            ))
        ),
        child: Text(
          title,
          style: TextStyle(
              fontSize: ScreenUtil().setSp(25.0),
              color: isbool?Colors.pink:Colors.black
          ),
        ),
      ),
    );
  }

}